﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Input;

namespace TrenchcoatRobots.Datatypes.Input {
	enum GamePadThumbstickAxis { LeftX, LeftY, RightX, RightY, None };
	/// <summary>
	/// GamePadThumbstickInput is a class for inputs from a GamePad thumbstick. Values will be closer to 1 the closer the thumbstick is to the max!!
	/// </summary>
	class GamePadThumbstickInput : GameInput {
		public GamePadThumbstickAxis currentAxis;

		public override void Update( ref GamePadState gps ) {
			if ( currentAxis == GamePadThumbstickAxis.LeftX ) {
				base.Value = gps.ThumbSticks.Left.X;
			}
			if ( currentAxis == GamePadThumbstickAxis.LeftY ) {
				base.Value = -gps.ThumbSticks.Left.Y;
			}
			if ( currentAxis == GamePadThumbstickAxis.RightX ) {
				base.Value = gps.ThumbSticks.Right.X;
			}
			if ( currentAxis == GamePadThumbstickAxis.RightY ) {
				base.Value = -gps.ThumbSticks.Right.Y;
			}
		}

		public GamePadThumbstickInput( GamePadThumbstickAxis axis, string name )
			: base( name ) {
			currentAxis = axis;
		}
	}
}
